var Base = require('../base.js');
var common = require('../../utils/common.js');

Page(common.extendPage(Base, {
	data: {},

	onLoad(options) {
		this.options = options;
		this._init();
	},

	onPullDownRefresh() {
		this._init();
	},

	onUnload() {
		common.goBackPage();
	},

	_init() {
		var _self = this;

		common.initApp({
			extSuc: function() {
				_self.initMPage(_self.options.pageId, function(data) {
					_self.setData(Object.assign(data, {
						dataLoaded: true
					}));
					_self.delayLoad();
					wx.stopPullDownRefresh();
				});
			},
			loginSuc: function() {
				_self.loginSuc();
			}
		});
	}


}));